package search

import (
    "context"
    "fmt"
    "log"
)

func HealthCheck() error {
    if Client == nil {
        return fmt.Errorf("Elasticsearch client not initialized")
    }

    _, _, err := Client.Ping("http://localhost:9200").Do(context.Background())
    if err != nil {
        return fmt.Errorf("Elasticsearch health check failed: %w", err)
    }

    log.Println("Elasticsearch health check passed")
    return nil
}